from typing import List


class Solution:
    def canJump(self, nums: List[int]) -> bool:
        if len(nums) == 1:
            return True
        max_step = 0
        for i in range(len(nums)):
            if i == len(nums) - 1:
                return False
            max_step = max(max_step, i + nums[i])
            if max_step == i:
                return False
            if max_step >= len(nums) - 1:
                return True
        return False

if __name__ == '__main__':
    nums = [2,3,1,1,4]
    solution = Solution()
    val = solution.canJump(nums)
    print(val)

